<?php

namespace app\ruinuo\controller;
use app\common\model\RuinuoDatabase;
use think\facade\View;

class Doc
{

    public function Database()
    {
        $RuinuoDatabase=new RuinuoDatabase();
        $list=$RuinuoDatabase->where("is_delete=0")->orderRaw("id asc")->select()->toArray();
        foreach ($list as $k=>$v)
        {
            $field=!empty($v['field']) ? json_decode($v['field'],true) : [];
            foreach ($field as $kk=>$vv)
            {
                $field[$kk]['key']=!empty($vv['key']) ? $vv['key'] : 2;
                $field[$kk]['default']=isset($vv['default']) ? $vv['default'] : '';
            }

            $list[$k]['field']=$field;


        }

        View::assign('list',$list);
        return ViewTpl('ruinuo/doc/database');
    }

    public function Api()
    {
        return ViewTpl('ruinuo/doc/api');
    }

    public function Menu()
    {
        $data['menu']=[];
        return BackCode($data);
    }

}